
package com.joysuch.wwyt.datadump.biz.query;

import cn.zlg.common.datadump.condition.QueryCondtionDef;
import cn.zlg.common.datadump.condition.QueryFieldCondition;
import cn.zlg.common.datadump.condition.QueryFieldConditionSet;
import cn.zlg.common.datadump.condition.SortFieldDef;
import com.joysuch.wwyt.bp.entity.dsl.QBPNFCLocation;
import com.joysuch.wwyt.bp.entity.dsl.QBpProductionFacility;
import com.querydsl.core.types.Order;

import java.util.Arrays;
import java.util.List;

public class BpNfcLocationDumpQueryBean implements QueryCondtionDef {

    @Override
    public List<QueryFieldConditionSet> getConditionSet() {
        return Arrays.asList(
                QueryFieldConditionSet.Builder().names("name", "nameOrCode").or(
                        new QueryFieldCondition("name", QBPNFCLocation.BPNFCLocation, QBPNFCLocation.BPNFCLocation.name,
                                QBPNFCLocation.BPNFCLocation.id, "contains"),
                        new QueryFieldCondition("name", QBPNFCLocation.BPNFCLocation, QBPNFCLocation.BPNFCLocation.code,
                                QBPNFCLocation.BPNFCLocation.id, "contains")
                ).build()
        );
    }

    @Override
    public QueryFieldCondition[] getAllConditionDef() {
        return new QueryFieldCondition[] {
                new QueryFieldCondition("ids", QBPNFCLocation.BPNFCLocation, QBPNFCLocation.BPNFCLocation.id,
                        QBPNFCLocation.BPNFCLocation.id, "in"),
                };
    }

    @Override
    public SortFieldDef[] getAllSortFieldDef() {
        return new SortFieldDef[] { new SortFieldDef(QBPNFCLocation.BPNFCLocation.name, "name", Order.ASC) };
    }
}
